﻿<phone:PhoneApplicationPage
    x:Class="CloudFox.Presentation.Views.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"    
    xmlns:mvvmlight="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7"
    xmlns:prismInteractivty="clr-namespace:Microsoft.Practices.Prism.Interactivity;assembly=Microsoft.Practices.Prism.Interactivity"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <!-- Pivot panel -->
    <controls:Pivot Name="categoryPivot" Title="{Binding Title}"
                    SelectedIndex="{Binding Category, Mode=TwoWay, Converter={StaticResource EnumToIntegerConverter}}">
        <controls:PivotItem Header="bookmarks">
            <ListBox Name="bookmarkListBox" Margin="0,0,-12,0" 
                     ItemsSource="{Binding Bookmarks}" 
                     SelectedItem="{Binding SelectedBookmark, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,0,0,17">
                            <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextLargeStyle}"/>
                            <TextBlock Text="{Binding Location}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextSubtleStyle}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </controls:PivotItem>

        <controls:PivotItem Header="history">
            <ListBox Name="historyListBox" Margin="0,0,-12,0" 
                     ItemsSource="{Binding History}" 
                     SelectedItem="{Binding SelectedHistoryItem, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,0,0,17">
                            <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextLargeStyle}"/>
                            <TextBlock Text="{Binding Location}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextSubtleStyle}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </controls:PivotItem>

        <controls:PivotItem Header="tabs">
            <ListBox Name="tabsListBox" Margin="0,0,-12,0"
                     ItemsSource="{Binding Tabs}"
                     SelectedItem="{Binding SelectedTab, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,0,0,17">
                            <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextLargeStyle}"/>
                            <TextBlock Text="{Binding Location}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextSubtleStyle}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </controls:PivotItem>
    </controls:Pivot>
    
    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar.refresh.rest.png" Text="Refresh" />
            <shell:ApplicationBarIconButton IconUri="/Images/appbar.folder.rest.png" Text="Folders" />
            <shell:ApplicationBarIconButton IconUri="/Images/appbar.feature.search.rest.png" Text="Search"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="Settings" Click="SettingsMenuItem_Click" />
                <shell:ApplicationBarMenuItem Text="Profile" Click="ProfileMenuItem_Click" />
                <shell:ApplicationBarMenuItem Text="About" Click="AboutMenuItem_Click"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    
    <!-- Use Prism to bind to the ApplicationBar -->
    <i:Interaction.Behaviors>
        <prismInteractivty:ApplicationBarButtonCommand ButtonText="Refresh" CommandBinding="{Binding Refresh}" />
        <prismInteractivty:ApplicationBarButtonCommand ButtonText="Folders" CommandBinding="{Binding SelectFolder}" />
        <prismInteractivty:ApplicationBarButtonCommand ButtonText="Search" CommandBinding="{Binding Search}" />
    </i:Interaction.Behaviors>

</phone:PhoneApplicationPage>